package com.Enumeration枚举类;

/**
 * 作    者 ：吾路巴尼
 * 创建时间 ：2025-02-17:39
 */
public class enumExercise02 {
    public static void main(String[] args) {
        Week[] str = Week.values();  // 通过values方法返回枚举Week的所有枚举对象，并赋值给数组str
        System.out.println("===所有星期的信息如下===");
        for (int i = 0; i < str.length; i++) {
            System.out.println( str[i].getWeek()); //遍历第i个枚举对象，并用getWeek方法获取星期信息name;
        }
    }
}

enum Week {
    MONDAY("星期一"), TUESDAY("星期二"), WEDNESDAY("星期三"), THURSDAY("星期四"), FRIDAY("星期五"), SATURDAY("星期六"), SUNDAY("星期日");
    private String name;

    Week(String week) {
        this.name = week;
    }

    public String getWeek() {
        return name;
    }


}